import 'package:demo_app_video/commons/http/http.dart';
import 'package:mobx/mobx.dart';

part 'user.g.dart';

class UserStore = _UserStore with _$UserStore;

abstract class _UserStore with Store {
  @observable
  late String token;

  @observable
  late ObservableMap<String, dynamic> userinfo;

  @observable
  late String uuid;

  @observable
  late String qing;

  @observable
  late String gexing;

  @action
  setgeXing(String value) {
    gexing = value;
  }

  @action
  setQing(String qingValue) {
    qing = qingValue;
  }

  @action
  setUuid(String uuidValuee) {
    uuid = uuidValuee;
  }

  @action
  setToken(String tokenTempData) async {
    token = tokenTempData;
  }

  @action
  setUserInfo() async {
    var resultData = await HttpUtil.getInstance().get('user/index');
    //没登录==清空本地各种信息
    if (resultData['code'] != 1) {}
    userinfo = ObservableMap.of(resultData['data']['userinfo']);
  }
}

final $UserStore = UserStore();
